package com.h2wallet.newsapi.modular.news.service.impl;

import com.h2wallet.newsapi.modular.basic.service.impl.EntityServiceImpl;
import com.h2wallet.newsapi.modular.news.entity.ArticleEntity;
import com.h2wallet.newsapi.modular.news.entity.ArticleTypeEntity;
import com.h2wallet.newsapi.modular.news.repository.ArticleRepository;
import com.h2wallet.newsapi.modular.news.repository.ArticleTypeRepository;
import com.h2wallet.newsapi.modular.news.service.ArticleService;
import com.h2wallet.newsapi.modular.news.service.ArticleTypeService;
import com.h2wallet.newsapi.modular.news.vo.Article;
import com.h2wallet.newsapi.modular.news.vo.ArticleType;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.Optional;

@Slf4j
@Service
public class ArticleTypeServiceImpl extends EntityServiceImpl<ArticleTypeEntity, ArticleType, Integer> implements ArticleTypeService {

    private final ArticleTypeRepository articleTypeRepository;

    public ArticleTypeServiceImpl(ArticleTypeRepository articleTypeRepository) {
        super(articleTypeRepository);
        this.articleTypeRepository = articleTypeRepository;
    }

    @Override
    protected ArticleType poToVo(ArticleTypeEntity po) {
        ArticleType articleType = super.poToVo(po);
        articleType.setCreateTime(po.getCreateTime().getTime());
        return articleType;
    }
}
